WP->longitude = pt2deg(wpt->pt.x);
WP->SetCreationTime(unpack_time(wpt->date, wpt->time));
for (j=WPT_NAME_LEN-1; j >= 0 && wpt->name[j] == ' '; j--) {};
- WP->shortname = xstrndup(wpt->name,j+1);
+ char *s = xstrndup(wpt->name,j+1);
+ WP->shortname = s;
+ xfree(s);
for (j=WPT_COMMENT_LEN-1; j >= 0 && wpt->comment[j] == ' '; j--) {};
if (j >= 0) {
char *s = xstrndup(wpt->comment, j+1);
RT = route_head_alloc();
RT->rte_num = i;
for (j=RTE_NAME_LEN-1; j >= 0 && rte->name[j] == ' '; j--) {};
- RT->rte_name = xstrndup(rte->name,j+1);
+ char *s = xstrndup(rte->name,j+1);
+ RT->rte_name = s;
+ xfree(s);
for (j=RTE_COMMENT_LEN-1; j >= 0 && rte->comment[j] == ' '; j--) {};
if (j >= 0) {
- RT->rte_desc = xstrndup(rte->comment,j+1);
+ char *s = xstrndup(rte->comment,j+1);
+ RT->rte_desc = s;
+ xfree(s);
} else {
- RT->rte_desc = xstrdup("");
+ RT->rte_desc = "";
}
route_add_head(RT);
// Apparently this is always zero terminated, though it's never been
// observed to be longer than 19 bytes + a null terminator.
- wpt_tmp->shortname = xstrdup(gbfgetstr(file_in));
+ wpt_tmp->shortname = gbfgetstr(file_in);
waypt_add(wpt_tmp);
}
static void
tlog3b_xgcb_wptid(xg_string args, const QXmlStreamAttributes* unused)
{
-#if NEW_STRINGS
xmlwpt->shortname = args;
-#else
- if (*args) {
- xmlwpt->shortname = xstrdup(args);
- }
-#endif
}
static void
tlog3b_xgcb_wptno(xg_string args, const QXmlStreamAttributes* unused)
{
-#if NEW_STRINGS
xmlNorthing = args.toDouble();
-#else
- xmlNorthing = atof(args);
-#endif
}
-
static void
tlog3b_xgcb_wptea(xg_string args, const QXmlStreamAttributes* unused)
{
-#if NEW_STRINGS
xmlEasting = args.toDouble();
-#else
- xmlEasting = atof(args);
-#endif
}
static void
tlog3b_xgcb_wptal(xg_string args, const QXmlStreamAttributes* unused)
{
-#if NEW_STRINGS
xmlAltitude = args.toDouble();
-#else
- xmlAltitude = atof(args);
-#endif
}
if (name && *name) {
switch (i) {
case 0:
- wpt->description = xstrdup(name);
+ wpt->description = name;
break;
case 1:
- wpt->shortname = xstrdup(name);
+ wpt->shortname = name;
break;
}
}